package com.lxj.controller.bus;

import com.lxj.common.Result;
import com.lxj.domain.BusReturn;
import com.lxj.dto.BusReturnDto;
import com.lxj.service.ReturnService;
import com.lxj.vo.BusReturnVo;
import com.lxj.vo.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lxj
 * @date 2021/6/21 9:44
 * @Description:
 */
@RestController
@RequestMapping("/busreturn")
public class BusReturnController {

    @Autowired
    private ReturnService returnService;

    /**
     * 归还车辆
     * @param rentId
     * @return
     */
    @PostMapping("/return.do")
    public Result returnCar(Integer rentId){
        return returnService.returnCar(rentId);
    }

    /**
     * 分页查询
     * @return
     */
    @GetMapping("/findByPage.do")
    public Result findByPage(BusReturnDto dto){
        PageInfo<BusReturnVo> pageInfo = returnService.findByPage(dto);
        return new Result(pageInfo);
    }
}
